namespace RetailAnalytic.Tools.MGrouping
{
    using System;
    using System.Data.SqlClient;

    public class Testing
    {
        static Testing()
        {
            Testing.id = 1;
        }

        public static void fillTree(string table, SqlConnection sqlConnection, int depth, int itemCount, int parentId)
        {
            for (int num1 = 1; num1 <= itemCount; num1++)
            {
                string text1 = string.Concat(new object[] { "Insert Into ", table, " (Id, parentId, name) Values (", Testing.id, ", ", parentId, ", 'Item_", depth, "_", num1, "')" });
                new SqlCommand(text1, sqlConnection).ExecuteNonQuery();
                Testing.id++;
                if (depth > 1)
                {
                    Testing.fillTree(table, sqlConnection, depth - 1, itemCount, Testing.id - 1);
                }
            }
        }


        private static int id;
    }
}

